import { _get, _post } from "../../utils/request";
import util from "../../utils/util";
const app = getApp();
Page({
    data: {
        address: ''
    },
    jump_about() {
        dd.navigateTo({
            url: '/pages/about/about'
        })
    },
    jump_password() {
        dd.navigateTo({
            url: '/pages/password/password'
        })
    },
    getName() {
        _get(`/set/getUserName`, { userId: app.userId }).then(res => {
            this.setData({
                user: res.data
            })
        })
    },
    logout() {
        _get(`/user/loginOut`, { userId: app.userId }).then(res => {
            console.log('退出', res);
            app.userId = '';
            dd.reLaunch({
                url: '/pages/login/login'
            })
        })
    },
    showAddress() {
        let that = this
        dd.getLocation({
            success(res) {
                that.setData({
                    address: res.address
                })
                console.log(res);

            },
            fail() {
                dd.alert({ title: '定位失败' });
            },
        })
    },
    onShow() {

    },
    onLoad() {
        dd.setNavigationBar({
            title: '设置',
            backgroundColor: '#142e4f',
            success() {},
            fail() {},
        });
        this.showAddress()
        this.getName();

    },
});